/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2019
 */

package net.dreamlu.db.po;


import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;


import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
 *
 * @author lambert.wang email:lambert.wang(a)crediteyes.com
 * @version 1.0
 * @since 1.0
 */
@Data
@Slf4j
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_role")
public class Role implements Serializable {
	private static final long	serialVersionUID	= 5454155825314635342L;
	//alias
	public static final String TABLE_ALIAS = "Role";
	public static final String ALIAS_ID = "主键id";
	public static final String ALIAS_NAME = "角色名";
	public static final String ALIAS_DESCRIPTION = "简介";
	public static final String ALIAS_ICON_CLS = "角色图标";
	public static final String ALIAS_SEQ = "排序号";
	public static final String ALIAS_STATUS = "状态[0:失效,1:正常]";
	public static final String ALIAS_CREATE_TIME = "创建时间";
	public static final String ALIAS_UPDATE_TIME = "更新时间";
	
	public static final String PROP_ID = "id";
	public static final String PROP_NAME = "name";
	public static final String PROP_DESCRIPTION = "description";
	public static final String PROP_ICON_CLS = "iconCls";
	public static final String PROP_SEQ = "seq";
	public static final String PROP_STATUS = "status";
	public static final String PROP_CREATE_TIME = "createTime";
	public static final String PROP_UPDATE_TIME = "updateTime";
	//columns START
    /**
     * 主键id       db_column: id 
     */ 	
	@Id 
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	private java.lang.Integer id;
    /**
     * 角色名       db_column: name 
     */ 	
	@Column(name = "name", unique = false, nullable = false, insertable = true, updatable = true, length = 64)
	private java.lang.String name;
    /**
     * 简介       db_column: description 
     */ 	
	@Column(name = "description", unique = false, nullable = true, insertable = true, updatable = true, length = 255)
	private java.lang.String description;
    /**
     * 角色图标       db_column: icon_cls 
     */ 	
	@Column(name = "icon_cls", unique = false, nullable = true, insertable = true, updatable = true, length = 32)
	private java.lang.String iconCls;
    /**
     * 排序号       db_column: seq 
     */ 	
	@Column(name = "seq", unique = false, nullable = false, insertable = true, updatable = true, length = 3)
	private Integer seq;
    /**
     * 状态[0:失效,1:正常]       db_column: status 
     */ 	
	@Column(name = "status", unique = false, nullable = false, insertable = true, updatable = true, length = 3)
	private Integer status;
    /**
     * 创建时间       db_column: create_time 
     */ 	
	@CreatedDate				
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
	@Column(name = "create_time", unique = false, nullable = false, insertable = true, updatable = true, length = 19)
	private java.time.LocalDateTime createTime;
    /**
     * 更新时间       db_column: update_time 
     */ 	
	@LastModifiedDate				
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
	@Column(name = "update_time", unique = false, nullable = false, insertable = true, updatable = true, length = 19)
	private java.time.LocalDateTime updateTime;
	//columns END
	@Override
	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.JSON_STYLE)
			.append(PROP_ID,getId())
			.append(PROP_NAME,getName())
			.append(PROP_DESCRIPTION,getDescription())
			.append(PROP_ICON_CLS,getIconCls())
			.append(PROP_SEQ,getSeq())
			.append(PROP_STATUS,getStatus())
			.append(PROP_CREATE_TIME,getCreateTime())
			.append(PROP_UPDATE_TIME,getUpdateTime())
			.toString();
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Role == false) return false;
		if(this == obj) return true;
		Role other = (Role)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
}
